/** 工程存储
 * @ 标  识: hchhIOT
 * @ 作  者: 阿拉丁矿工 黄传鸿 <hchhyzc@foxmail.com>
 */
/* ================================================================================================ */
//                                ★ 引入
/* ================================================================================================ */
import { defineStore } from "pinia";


/**———————————————————————————————————————————————————————————————————————————————————————————————— */
//                                ★ 存储
/**———————————————————————————————————————————————————————————————————————————————————————————————— */
export const useProjectStore = defineStore({
  id: "useProjectStore",
  /* ================================================================================================ */
  //                               ★ state
  /* ================================================================================================ */
  state: (): any => {

    return {
      /** 工程列表 */
      projectList: [],
      /* ================================================================================================ */
      /* ------------------------------------------------------------------------ */
      /*  当前工程 */
      /* ------------------------------------------------------------------------ */
      /** 工程名称 */
      label: "默认工程",
      /** 工程ID */
      key: "defaultPro",
      /** 保存日期 */
      calendar: "传鸿组态2.0",
      /** 页面索引 */
      pageIndex: 0,
      /** 页面id */
      pageId: 'page1',
      /** 工程中的页面 */
      pages: [
        {
          label: '页面0',
          key: 'page1',
          /** 画布属性 */
          canvasAttr: {
            // 🦢 页面
            /** 页面名称 */
            pageName: "页面0",
            /** 页面键 */
            pageKey: "page1",
            /** 页面尺寸 */
            pageSize: "svg_icon",
            /** 页面方向 */
            pageOrientation: "PageHorizontal",
            /** 页面精度 */
            pageAccuracy: "0级",
            /** 页面单位 */
            pageUnit: "px",

            // 🦢 画布
            /** 画布缩放 */
            canvasScale: 1,
            /** 画布背景色 */
            canvasBackColor: "rgba(0,0,0,1)",
            /** 画布宽度 */
            canvasWidth: 1024,
            /** 画布高度 */
            canvasHeight: 1024,
            // 🦢 格栅
            /** 格栅模式选项:1-无格栅;2-点格栅;3-方格; */
            gridModel: 1,
            /** 格栅样式选项:1-像素尺寸;2-均分画布;3-按宽高均分画布;*/
            gridStyle: 1,
            /** 格栅间距 */
            gridSpace: 10,
            /** 宽等分数 */
            gridBisectionWidthCont: 10,
            /** 宽等分数 */
            gridBisectionHeightCont: 10,
            /** 格栅点颜色 */
            gridDotColor: "rgba(255,255,255,1)",
            /** 小格颜色 */
            gridColorMini: "rgb(255,255,255)",
            /** 大格颜色 */
            gridColorMax: "rgb(255,255,255)",
            /** 格栅宽度 */
            gridWidth: 10,
            /** 格栅高度 */
            gridHeight: 10,

            // 🦢 光标
            /** 显示光标 */
            isShowCursor: false,
            /** 光标颜色 */
            cursorColor: "rgb(214,214,214)",
            /** 光标盒子尺寸 */
            cursorBoxSize: 30,
            /** 光标长度 */
            cursorLang: 1600,
            /** 光标线宽度 */
            cursorLineWidth: 1,
            
            // 🦢 捕捉
            /** 捕捉 */
            isCatch: true,
            /** 捕捉距离 */
            catchRange: 1,
            /** 捕捉到 上左 */
            catchUpLeft: false,
            /** 捕捉到 上 */
            catchUp: false,
            /** 捕捉到 上右 */
            catchUpRight: false,
            /** 捕捉到 左 */
            catchLeft: false,
            /** 捕捉到 中 */
            catchMidle: false,
            /** 捕捉到 右 */
            catchRight: false,
            /** 捕捉到 下右 */
            catchDownRight: false,
            /** 捕捉到 下 */
            catchDown: false,
            /** 捕捉到 下左 */
            catchDownLeft: false,

            // 🦢 标尺
            ruleLineColor: 'rgba(0,0,255,1)'
          },
          /** 图元数据 */
          pels: [],
        }
      ],
      /** 元素计数 */
      elementCont: [
        {
          "label": "笔筒_数量",
          "key": "penContainerCont",
          "val": 0
        },
        {
          "label": "画笔_数量",
          "key": "penCont",
          "val": 0
        },
        {
          "label": "页面_数量",
          "key": "pageCont",
          "val": 0
        },
        {
          "label": "布局_数量",
          "key": "layoutCont",
          "val": 0
        },
        {
          "label": "包_数量",
          "key": "wrapCont",
          "val": 0
        },
        {
          "label": "水平线_数量",
          "key": "horizontaLineCont",
          "val": 0
        },
        {
          "label": "垂直线_数量",
          "key": "verticalLineCont",
          "val": 0
        },
        {
          "label": "斜线_数量",
          "key": "slantLineCont",
          "val": 0
        },
        {
          "label": "圆_数量",
          "key": "circleCont",
          "val": 0
        },
        {
          "label": "椭圆_数量",
          "key": "ellipseCont",
          "val": 0
        },
        {
          "label": "矩形_数量",
          "key": "rectangleCont",
          "val": 0
        },
        {
          "label": "三点弧线_数量",
          "key": "arcCont",
          "val": 0
        },
        {
          "label": "圆分多边形_数量",
          "key": "circlePolygonCont",
          "val": 0
        },
        {
          "label": "扇形_数量",
          "key": "sectorCont",
          "val": 0
        },
        {
          "label": "多边形_数量",
          "key": "polygonCont",
          "val": 0
        },
        {
          "label": "折线_数量",
          "key": "polylineCont",
          "val": 0
        },
        {
          "label": "路径_数量",
          "key": "pathCont",
          "val": 0
        },
        {
          "label": "Svg文本_数量",
          "key": "svgTextCont",
          "val": 0
        },

        {
          "label": "DIV文本_数量",
          "key": "divTextCont",
          "val": 0,
        },
        {
          "label": "图片_数量",
          "key": "svgImageCont",
          "val": 0
        },
        {
          "label": "块_数量",
          "key": "divBlockCont",
          "val": 0
        },
        {
          "label": "块组_数量",
          "key": "blockGroupCont",
          "val": 0
        },
        {
          "label": "驱动_数量",
          "key": "driveCont",
          "val": 0
        },

      ],
      /* ================================================================================================ */
      /** 日志 */
      logs: [],
    }
  },

  /* ================================================================================================ */
  //                               ★ getters
  /* ================================================================================================ */
  getters: {},

  /* ================================================================================================ */
  //                               ★ actions
  /* ================================================================================================ */
  actions: {

  },
});
